package com.lhf.planClass.mapper;

import com.lhf.planClass.model.PlanClasUpdateStatusVo;
import com.lhf.planClass.model.PlanClassSelectVo;
import com.lhf.planClass.model.PlanClassVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * @author 尐痞猫
 * @date2021-06-24 10:22
 */
@Mapper
public interface PlanClassVoMapper {
    List<PlanClassVo> queryPage(PlanClassSelectVo planClassSelectVo);

    int queryCount();
    @Select("select count(id) from planclass where code = #{code}")
    int queryByCode(@NotBlank(message = "编号不能为空") String code);

    @Select("select count(id) from planclass where name = #{name}")
    int queryByName(@NotBlank(message = "编号不能为空") String name);

    int insert(PlanClassVo planClassVo);

    int update(PlanClassVo planClassVo);


    PlanClassVo queryById(Integer id);

    @Update("update planclass set status = #{status} ,updateName = #{updateName},updateTime = #{updateTime} where id = #{id}")
    int updateStatus(PlanClassVo planClassVo);
}
